package com.project.study.farming.common.config;

import com.project.study.farming.common.interceptor.FarmingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 配置拦截器
 * @since 2020-03-03
 */
//@Configuration
//@Component
public class InterceptorConfig extends WebMvcConfigurationSupport {

    @Autowired
    private FarmingInterceptor farmingInterceptor;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(farmingInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/static/**")
                .excludePathPatterns("/assets/**")
                .excludePathPatterns("/css/**")
                .excludePathPatterns("/fonts/**")
                .excludePathPatterns("/images/**")
                .excludePathPatterns("/js/**");
        super.addInterceptors(registry);
    }
}
